package com.jinlia.show.modules.base.system.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jinlia.show.common.core.entity.BaseEntity;
import com.jinlia.show.modules.base.config.DynamicSchemaConfig;
import com.jinlia.show.modules.base.constant.ErrandOrderStatusEnum;
import com.jinlia.show.modules.base.constant.i.IBaseEnum;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 达达配送
 */
@Data
@TableName(value = "erp_errand_order", schema = DynamicSchemaConfig.schema_system)
public class ErrandOrder extends BaseEntity {
    @TableId
    private Long id;
    /**
     * 跑腿平台单号
     */
    private String errandSourceNum;
    /**
     * 跑腿平台距离
     */
    private String errandDistance;
    /**
     * 本系统配送单id
     */
    private Long deliveryOrderId;
    /**
     * 本系统销售单id
     */
    private Long orderId;

    /**
     * 0:直接下单，1:查询后下单，2重新下单
     */
    private Integer orderMethod;
    private String request;//查询下单请求
    private String requestSecond;//第二次请求
    private String responseLast;//相应
    //	订单状态(待接单＝1,待取货＝2,配送中＝3,已完成＝4,已取消＝5, 指派单=8,妥投异常之物品返回中=9, 妥投异常之物品返回完成=10,
    //	骑士到店=100,创建达达运单失败=1000 可参考文末的状态说明）
    //见    ErrandOrderStatusEnum
    private Integer errandOrderStatus;
    private String cancelCode;//取消码
    private String cancelReason;//取消原因
    @TableField(exist = false)
    private String errandOrderStatusName;

    //骑手姓名
    private String transporterName;
    //骑手电话
    private String transporterPhone;
    //运费
    private BigDecimal deliveryFee;
    /**
     * 商品启用状态
     */
    private Integer enableStatus;

    public void setErrandOrderStatus(Integer errandOrderStatus) {
        this.errandOrderStatus = errandOrderStatus;
        this.errandOrderStatusName = IBaseEnum.getLabelByValue(errandOrderStatus,ErrandOrderStatusEnum.class);
    }
}
